package cn.buk.qms;

import cn.buk.tms.dto.PassengerDto;
import cn.buk.common.util.DateUtil;
import cn.buk.tms.entity.base.Airport;
import cn.buk.tms.entity.bill.*;
import cn.buk.tms.entity.misc.Customer;
import cn.buk.tms.entity.misc.DataFieldExportInfo;
import cn.buk.tms.entity.misc.DataFieldInfo;
import cn.buk.tms.entity.misc.FlightInfo;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static cn.buk.tms.entity.misc.DataFieldInfo.*;
import static cn.buk.tms.common.constant.TmsOrderConstant.*;

/**
 * @author yfdai
 */
public class BillUtil {

  private BillUtil() {
    throw new IllegalStateException("Utility class");
  }

  private static final Logger logger = LogManager.getLogger(BillUtil.class);

  //LZHPEK/CA1876/S/2018-01-10 自定义的航班信息格式字符串 短格式
  private static final String REGEXP_SHORT = "[A-Z]{6}/[0-9A-Z]{3,8}/[A-Z-]/[0-9-]{10}";
  private static final Pattern PATTERN_SHORT = Pattern.compile(REGEXP_SHORT);

  //LZHPEK/CA1876/S/2018-01-10/2050/2350//T3 自定义的航班信息格式字符串 长格式
  private static final String REGEXP_LONG = "[A-Z]{0,6}/[0-9A-Z]{3,8}/[A-Z-]/[0-9-]{10}/[0-9:]{0,5}/[0-9:]{0,5}/[0-9A-Z]{0,3}/[0-9A-Z]{0,3}[/01]{0,2}";
  private static final Pattern PATTERN_LONG = Pattern.compile(REGEXP_LONG);

  private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";

  private static DataFieldExportInfo createExportDateField(int dataType, int col, String alias, int fieldId) {
    DataFieldExportInfo exportInfo = new DataFieldExportInfo();
    exportInfo.setDataType(dataType);
    exportInfo.setColumnIndex(col);
    exportInfo.setAlias(alias);
    DataFieldInfo dataFieldInfo = new DataFieldInfo();
    dataFieldInfo.setId(fieldId);
    exportInfo.setDataFieldInfo(dataFieldInfo);

    return exportInfo;
  }

  /**
   * 机票账单导出：默认格式0
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4FlightFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = DATA_TYPE_GENERAL;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_FLIGHT;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票号", DataFieldConst.FLIGHT_TICKET_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "乘机人", DataFieldConst.FLIGHT_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.FLIGHT_RECEIVE_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "使用状态", DataFieldConst.FLIGHT_USED_STATUS));
    // 编码,航班号,舱位,出发,出发机场,出发航站楼,到达,到达机场,到达航站楼,出发日期,出发时间,到达时间,全部行程,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "编码", DataFieldConst.FLIGHT_PNR_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航班号", DataFieldConst.FLIGHT_FLIGHT_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "舱位", DataFieldConst.FLIGHT_SUB_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发", DataFieldConst.FLIGHT_DPORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发机场", DataFieldConst.FLIGHT_DPORT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发航站楼", DataFieldConst.FLIGHT_DTERM));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达", DataFieldConst.FLIGHT_APORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达机场", DataFieldConst.FLIGHT_APORT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达航站楼", DataFieldConst.FLIGHT_ATERM));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发日期", DataFieldConst.FLIGHT_DDATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "全部行程", DataFieldConst.FLIGHT_ROUTE_INFO));
    // 备注,公布票价,票价,税,服务费,保险费,票总计,代理费,优惠金额,利润,操作员,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.FLIGHT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "公布票价", DataFieldConst.FLIGHT_PRICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票价", DataFieldConst.FLIGHT_PAR_VALUE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "税", DataFieldConst.FLIGHT_TAX));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.FLIGHT_SERVICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "保险费", DataFieldConst.FLIGHT_INSURANCE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票总计", DataFieldConst.FLIGHT_AMOUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "代理费", DataFieldConst.FLIGHT_COMMISSION));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "优惠金额", DataFieldConst.FLIGHT_DISCOUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.FLIGHT_PROFIT));

    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));

    return exportInfos;
  }

  /**
   * 机票账单导出：默认格式1
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4FlightFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = DATA_TYPE_GENERAL;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));

    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_FLIGHT;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "姓名", DataFieldConst.FLIGHT_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发日期", DataFieldConst.FLIGHT_DDATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发机场", DataFieldConst.FLIGHT_DPORT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达机场", DataFieldConst.FLIGHT_APORT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航班号", DataFieldConst.FLIGHT_FLIGHT_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "舱位", DataFieldConst.FLIGHT_SUB_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "编码", DataFieldConst.FLIGHT_PNR_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票价", DataFieldConst.FLIGHT_PAR_VALUE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "税", DataFieldConst.FLIGHT_TAX));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.FLIGHT_SERVICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票号", DataFieldConst.FLIGHT_TICKET_NO));

    dataType = DATA_TYPE_GENERAL;

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));

    dataType = DATA_TYPE_FLIGHT;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "十位票号", DataFieldConst.TEN_TICKET_NO));

    return exportInfos;
  }


  /**
   * 退票账单导出: 默认格式0
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4RefundFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = DATA_TYPE_GENERAL;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_FLIGHT_REFUND;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票号", DataFieldConst.FLIGHT_TICKET_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "乘机人", DataFieldConst.FLIGHT_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "退票单号", DataFieldConst.FLIGHT_RECEIVE_STATUS)); //?
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原订单号", DataFieldConst.FLIGHT_USED_STATUS)); //?
    // 编码,航班号,舱位,出发,出发机场,出发航站楼,到达,到达机场,到达航站楼,出发日期,出发时间,到达时间,全部行程,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "退费类型?", DataFieldConst.REFUND_REASON));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航班号", DataFieldConst.FLIGHT_FLIGHT_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "舱位", DataFieldConst.FLIGHT_SUB_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发机场", DataFieldConst.FLIGHT_DPORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发航站楼", DataFieldConst.FLIGHT_DTERM));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达机场", DataFieldConst.FLIGHT_APORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达航站楼", DataFieldConst.FLIGHT_ATERM));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发日期", DataFieldConst.FLIGHT_DDATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达时间", DataFieldConst.FLIGHT_ATIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "全部行程", DataFieldConst.FLIGHT_ROUTE_INFO));
//        销售时实收,退票费,服务费,航司实退,实退客人,航司退款日期,退给乘客日期,操作员,处理人,操作员,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售时实收", DataFieldConst.REFUND_TICKET_AMOUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "退票费", DataFieldConst.REFUND_AIR_CHARGE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.FLIGHT_SERVICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航司实退", DataFieldConst.REFUND_FINAL_AIR_REFUND));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "实退客人", DataFieldConst.REFUND_FINAL_PSG_REFUND));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航司退款日期", DataFieldConst.REFUND_DATE_AIR_REFUND));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "退给乘客日期", DataFieldConst.REFUND_DATE_PSG_REFUND));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.FLIGHT_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "处理人", DataFieldConst.FLIGHT_OP2));

    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));

    return exportInfos;
  }

  /**
   * 退票账单导出: 默认格式1
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4RefundFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = DATA_TYPE_GENERAL;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));


    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_FLIGHT_REFUND;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "姓名", DataFieldConst.FLIGHT_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发日期", DataFieldConst.FLIGHT_DDATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发机场", DataFieldConst.FLIGHT_DPORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达机场", DataFieldConst.FLIGHT_APORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航班号", DataFieldConst.FLIGHT_FLIGHT_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "舱位", DataFieldConst.FLIGHT_SUB_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达时间", DataFieldConst.FLIGHT_ATIME));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "编码", DataFieldConst.FLIGHT_PNR_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "实退客人", DataFieldConst.REFUND_FINAL_PSG_REFUND));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "税", DataFieldConst.FLIGHT_TAX));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.FLIGHT_SERVICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票号", DataFieldConst.FLIGHT_TICKET_NO));

    dataType = DATA_TYPE_GENERAL;
    //        // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));

    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));


    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));

    return exportInfos;
  }


  /**
   * 改签账单导出：默认格式0
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4ChangeFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = DATA_TYPE_GENERAL;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_FLIGHT_CHANGE;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票号", DataFieldConst.FLIGHT_TICKET_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "乘机人", DataFieldConst.FLIGHT_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原编码", DataFieldConst.FLIGHT_PNR_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "改签单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航班号", DataFieldConst.FLIGHT_FLIGHT_NO));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "舱位", DataFieldConst.FLIGHT_SUB_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发机场", DataFieldConst.FLIGHT_DPORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发航站楼", DataFieldConst.FLIGHT_DTERM));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达机场", DataFieldConst.FLIGHT_APORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达航站楼", DataFieldConst.FLIGHT_ATERM));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发日期", DataFieldConst.FLIGHT_DDATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "全部行程", DataFieldConst.FLIGHT_ROUTE_INFO));
    // 备注,公布票价,票价,税,服务费,保险费,票总计,代理费,优惠金额,利润,操作员,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售价", DataFieldConst.FLIGHT_PAR_VALUE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "税", DataFieldConst.FLIGHT_TAX));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航司改签费", DataFieldConst.CHANGE_AIR_CHARGE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "我司服务费", DataFieldConst.FLIGHT_SERVICE));

    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "处理人", DataFieldConst.BILL_OP2));

    dataType = DATA_TYPE_FLIGHT_CHANGE;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "新编码", DataFieldConst.CHANGE_PNR_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "新票号", DataFieldConst.CHANGE_TICKET_NO));

    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));

    return exportInfos;
  }

  /**
   * 改签账单导出：默认格式1
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4ChangeFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = DATA_TYPE_GENERAL;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_FLIGHT_CHANGE;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "姓名", DataFieldConst.FLIGHT_PASSENGER));
    // 编码,航班号,舱位,出发,出发机场,出发航站楼,到达,到达机场,到达航站楼,出发日期,出发时间,到达时间,全部行程,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发日期", DataFieldConst.FLIGHT_DDATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发机场", DataFieldConst.FLIGHT_DPORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达机场", DataFieldConst.FLIGHT_APORT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "航班号", DataFieldConst.FLIGHT_FLIGHT_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "舱位", DataFieldConst.FLIGHT_SUB_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达时间", DataFieldConst.FLIGHT_DTIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "编码", DataFieldConst.FLIGHT_PNR_NO));
    // 备注,公布票价,票价,税,服务费,保险费,票总计,代理费,优惠金额,利润,操作员,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票价", DataFieldConst.FLIGHT_PAR_VALUE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "税", DataFieldConst.FLIGHT_TAX));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.FLIGHT_SERVICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票号", DataFieldConst.CHANGE_TICKET_NO));

    dataType = DATA_TYPE_GENERAL;
    //        // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));

    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));


    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
//        //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));

    return exportInfos;
  }


  /**
   * Hotel账单导出：默认格式0
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4HotelFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_HOTEL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "酒店", DataFieldConst.HOTEL_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "房型", DataFieldConst.HOTEL_ROOM_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "入住人", DataFieldConst.HOTEL_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "入住日期", DataFieldConst.HOTEL_CHECK_IN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "离店日期", DataFieldConst.HOTEL_CHECK_OUT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "房间数", DataFieldConst.HOTEL_ROOM_COUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "间夜", DataFieldConst.HOTEL_ROOM_NIGHT_COUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售价/间夜", DataFieldConst.HOTEL_PRICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "底价/间夜", DataFieldConst.HOTEL_BOTTOM_PRICE));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.HOTEL_SERVICE));

    dataType = DATA_TYPE_GENERAL;
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "总金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "总成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));


    return exportInfos;
  }

  /**
   * Hotel账单导出：默认格式1
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4HotelFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));

    dataType = DATA_TYPE_HOTEL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "入住人", DataFieldConst.HOTEL_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "入住日期", DataFieldConst.HOTEL_CHECK_IN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "酒店", DataFieldConst.HOTEL_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "房型", DataFieldConst.HOTEL_ROOM_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "离店日期", DataFieldConst.HOTEL_CHECK_OUT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "间/夜", DataFieldConst.HOTEL_PRICE)); //?价格
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "天数", DataFieldConst.HOTEL_ROOM_NIGHT_COUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));

    dataType = DATA_TYPE_GENERAL;
    //        // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));

    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));


    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
//        //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));


    return exportInfos;
  }


  /**
   * Train账单导出：默认格式0
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4TrainFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_TRAIN;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "乘客姓名", DataFieldConst.TRAIN_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "车次", DataFieldConst.TRAIN_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发", DataFieldConst.TRAIN_DEPARTURE_STATION));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达", DataFieldConst.TRAIN_ARRIVAL_STATION));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "日期", DataFieldConst.TRAIN_DEPARTURE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "座位等级", DataFieldConst.TRAIN_SEAT_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "价格", DataFieldConst.TRAIN_PRICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.TRAIN_SERVICE));

    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));


    return exportInfos;
  }

  /**
   * Train账单导出：默认格式1
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4TrainFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));

    dataType = DATA_TYPE_TRAIN;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "乘客姓名", DataFieldConst.TRAIN_PASSENGER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "日期", DataFieldConst.TRAIN_DEPARTURE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发", DataFieldConst.TRAIN_DEPARTURE_STATION));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达", DataFieldConst.TRAIN_ARRIVAL_STATION));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "车次", DataFieldConst.TRAIN_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "座位等级", DataFieldConst.TRAIN_SEAT_CLASS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "票价", DataFieldConst.TRAIN_PRICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务费", DataFieldConst.TRAIN_SERVICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));


    dataType = DATA_TYPE_GENERAL;
    //        // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));

    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));


    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
//        //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));

    return exportInfos;
  }


  /**
   * Vas账单导出：默认格式0
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4VasFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));
    // 票号,乘机人,收款状态,使用状态,
    dataType = DATA_TYPE_VAS;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "增值产品名称", DataFieldConst.VAS_PRODUCT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "单价", DataFieldConst.VAS_PRICE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "数量", DataFieldConst.VAS_COUNT));

    dataType = DATA_TYPE_GENERAL;
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "实收", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    dataType = DATA_TYPE_VAS;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.VAS_REMARK));
    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));


    return exportInfos;
  }



  /**
   * Vas账单导出：默认格式1
   *
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4VasFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));

    dataType = DATA_TYPE_VAS;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "姓名", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "服务名称", DataFieldConst.VAS_PRODUCT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "实收客户", DataFieldConst.VAS_AMOUNT));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));

    dataType = DATA_TYPE_GENERAL;
    //        // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));

    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));


    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
//        //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));


    return exportInfos;
  }

  /**
   * 租车账单导出：默认格式
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4CarFormatZero() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本中心", DataFieldConst.BILL_COST_CENTER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "项目名称", DataFieldConst.BILL_PROJECT_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票日期", DataFieldConst.BILL_ETDZ_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单号", DataFieldConst.BILL_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "国际?", DataFieldConst.BILL_IS_INTL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核状态", DataFieldConst.BILL_AUDIT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算日期", DataFieldConst.BILL_SETTLE_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "结算单号", DataFieldConst.BILL_SETTLE_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款备注", DataFieldConst.BILL_RECEIPT_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款单号", DataFieldConst.BILL_RECEIPT_NO));
    //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销账日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付状态", DataFieldConst.BILL_PAYMENT_STATUS));
    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));
    // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单金额", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    dataType = DATA_TYPE_CAR;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "用车类型", DataFieldConst.CAR_USE_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发", DataFieldConst.CAR_DEPARTURE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达", DataFieldConst.CAR_ARRIVAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "使用时间", DataFieldConst.CAR_USE_TIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "联系人", DataFieldConst.CAR_LINK_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "车型", DataFieldConst.CAR_VEHICLE_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.CAR_REMARK));

    dataType = DATA_TYPE_GENERAL;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "操作员", DataFieldConst.BILL_OPERATOR));


    return exportInfos;
  }

  /**
   * 租车账单导出：默认格式1
   * @return
   */
  static List<DataFieldExportInfo> createExportFields4CarFormatOne() {
    List<DataFieldExportInfo> exportInfos = new ArrayList<>();

    int dataType = 0;
    int col = 0;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "类型", DataFieldConst.BILL_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户", DataFieldConst.BILL_CUSTOMER_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户代码", DataFieldConst.BILL_CUSTOMER_CODE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订单号", DataFieldConst.BILL_ORDER_NO));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "原始单号", DataFieldConst.BILL_FLIGHT_ORDER_NO));

    dataType = DATA_TYPE_CAR;
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "联系人", DataFieldConst.CAR_LINK_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "用车时间", DataFieldConst.CAR_USE_TIME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出发", DataFieldConst.CAR_DEPARTURE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "到达", DataFieldConst.CAR_ARRIVAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "车型", DataFieldConst.CAR_VEHICLE_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "用车城市", DataFieldConst.CAR_CITY_NAME));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "用车类型", DataFieldConst.CAR_USE_TYPE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "用车备注", DataFieldConst.CAR_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "", DataFieldConst.COLUMN_BLANK));

    dataType = DATA_TYPE_GENERAL;
    //        // 账单金额,成本,利润,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "客户应付", DataFieldConst.BILL_TOTAL));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "成本", DataFieldConst.BILL_COST));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "利润", DataFieldConst.BILL_PROFIT));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "供应商", DataFieldConst.BILL_SUPPLIER));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "支付方式", DataFieldConst.BILL_PAYMENT_METHOD));

    // 订票人,出票人,审核人,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "订票人", DataFieldConst.BILL_OP1));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "出票人", DataFieldConst.BILL_OP2));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核人", DataFieldConst.BILL_OP3));

    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "账单日期", DataFieldConst.BILL_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "审核日期", DataFieldConst.BILL_AUDIT_DATE));


    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "备注", DataFieldConst.BILL_REMARK));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款状态", DataFieldConst.BILL_RECEIPT_STATUS));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款方式", DataFieldConst.BILL_RECEIPT_TYPE));
//        //销账日期,供应商,支付方式,支付状态,
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "收款日期", DataFieldConst.BILL_WRITE_OFF_DATE));
    col += 1;
    exportInfos.add(createExportDateField(dataType, col, "销售员", DataFieldConst.BILL_SALE_MAN));


    return exportInfos;
  }


  public static List<DataFieldExportInfo> getExportInfos(final String billType0, final int format) {
    List<DataFieldExportInfo> exportInfos = null;

    final String billType = "-1".equalsIgnoreCase(billType0) ? BILL_TYPE_FLIGHT : billType0;
    switch (billType) {
      case BILL_TYPE_FLIGHT_REFUND:
        exportInfos = format == 0 ? createExportFields4RefundFormatZero() : createExportFields4RefundFormatOne();
        break;
      case BILL_TYPE_FLIGHT_CHANGE:
        exportInfos = format == 0 ? createExportFields4ChangeFormatZero() : createExportFields4ChangeFormatOne();
        break;
      case BILL_TYPE_HOTEL:
        exportInfos = format == 0 ? createExportFields4HotelFormatZero() : createExportFields4HotelFormatOne();
        break;
      case BILL_TYPE_TRAIN:
        exportInfos = format == 0 ? createExportFields4TrainFormatZero() : createExportFields4TrainFormatOne();
        break;
      case BILL_TYPE_VAS:
        exportInfos = format == 0 ? createExportFields4VasFormatZero() : createExportFields4VasFormatOne();
        break;
      case BILL_TYPE_CAR:
        exportInfos = format == 0 ? createExportFields4CarFormatZero() : createExportFields4CarFormatOne();
        break;
      default:
        exportInfos = format == 0 ? createExportFields4FlightFormatZero() : createExportFields4FlightFormatOne();
    }
    return exportInfos;
  }


  /**
   * 查找客户对应的销售员
   */
  private static String getSaleManByCustomer(final int enterpriseId, final int customerId,
                                             final String customerCode, final List<Customer> customers) {
    if (customerId > 0) {
      //企业客户
      for (Customer c : customers) {
        if (c.getEnterpriseId() == enterpriseId && c.getId() == customerId) {
          return c.getSalesStaff();
        }
      }
    } else if (customerId == 0 && customerCode != null && customerCode.length() > 0) {
      //企业散客
      for (Customer c : customers) {
        if (c.getEnterpriseId() == enterpriseId && customerCode
                .equalsIgnoreCase(c.getCustomerCode())) {
          return c.getSalesStaff();
        }
      }
    }

    return "";
  }

  private static String getBillTypeDesc(String val) {
    if (val.equals(BILL_TYPE_FLIGHT)) {
      return "机票";
    } else if (val.equals(BILL_TYPE_FLIGHT_REFUND)) {
      return "退票";
    } else if (val.equals(BILL_TYPE_FLIGHT_CHANGE)) {
      return "改签";
    } else if (val.equals(BILL_TYPE_VAS)) {
      return "服务";
    } else if (val.equals(BILL_TYPE_HOTEL)) {
      return "酒店";
    } else if (val.equals(BILL_TYPE_TRAIN)) {
      return "火车票";
    } else if (val.equals(BILL_TYPE_CAR)) {
      return "用车";
    } else {
      return val;
    }
  }

  private static String getIntlTicketDesc(int val) {
    return val == 1 ? "国际" : "国内";
  }

  private static String getPayTypeNoteDesc(String val) {
    if ("1".equals(val)) {
      return "现金";
    } else if ("2".equals(val)) {
      return "信用卡";
    }
    if ("4".equals(val)) {
      return "支票";
    }
    if ("8".equals(val)) {
      return "记账";
    } else {
      return val == null ? "" : val;
    }
  }

  private static String getBePaidDesc(String bePaid) {
    if ("1".equals(bePaid)) {
      return "已收";
    } else {
      return "未收";
    }
  }

  private static String showReasonCodeDesc(int reasonCode) {
//        * 0-自愿退票
//                * 1-非自愿退票
//                * 4-废票
    switch (reasonCode) {
      case 0:
        return "自愿退票";
      case 1:
        return "非自愿退票";
      case 4:
        return "废票";
      default:
        return "?";
    }
  }


  private static String getAirportName(final String threeCode, final List<Airport> airports) {
    String retVal = "";
    for (Airport airport : airports) {
      if (threeCode.equalsIgnoreCase(airport.getThreeCode())) {
        String temp = airport.getCityName();

        if ("SHA,PVG,PEK,NAY,PKX".contains(threeCode) && airport.getNameCN() != null) {
          temp += airport.getNameCN().trim();
        }

        retVal = temp;
        break;
      }
    }

    return retVal;
  }

  public static void processRouteDetail(final String routeDetail0, final List<FlightInfo> flights) {
    // LZHPEK/CA1876/S/2018-01-10/2050/2350//T3
    if (routeDetail0 == null) {
      return;
    }

    String routeDetail = routeDetail0;
    Matcher m = PATTERN_LONG.matcher(routeDetail);

    int findCount = 0; // 找到的次数

    while (m.find()) {
      findCount++;
      final String temp = routeDetail.substring(m.start(), m.end());

      String[] items = temp.split("/");
      try {
        FlightInfo info = new FlightInfo();
        if (items[0].length() >= 6) {
          info.setDepartureAirport(items[0].substring(0, 3));
          info.setArrivalAirport(items[0].substring(3));
        }

        info.setFlightNo(items[1]);
        info.setSubclass(items[2]);
        info.setDepartureDate(items[3]);

        if (items.length >= 6) {
          info.setDepartureTime(items[4]);
          info.setArrivalTime(items[5]);
        }

        if (items.length >= 7) {
          info.setDepartureTerminal(items[6]);
        }

        if (items.length >= 8) {
          info.setArrivalTerminal(items[7]);
        }

        if (items.length >= 9) {
          info.setFlightType(Integer.parseInt(items[8]));
        }

        flights.add(info);
      } catch (Exception ex) {
        logger.error(ex.getMessage() + ". :" + routeDetail);
      }

      routeDetail = routeDetail.substring(m.end());
      if (routeDetail.length() == 0) {
        break;
      } else {
        m = PATTERN_LONG.matcher(routeDetail);
      }
    }

    if (findCount == 0) {
      // 长格式没有，去匹配短格式
      processRouteDetailShort(routeDetail0, flights);
    }
  }

  public static void processRouteDetailShort(final String routeDetail0,
                                             final List<FlightInfo> flights) {
    // LZHPEK/CA1876/S/2018-01-10/

    String routeDetail = routeDetail0;
    Matcher m = PATTERN_SHORT.matcher(routeDetail);
    while (m.find()) {
      final String temp = routeDetail.substring(m.start(), m.end());
      String[] items = temp.split("/");
      try {
        FlightInfo info = new FlightInfo();
        info.setDepartureAirport(items[0].substring(0, 3));
        info.setArrivalAirport(items[0].substring(3));

        info.setFlightNo(items[1]);
        info.setSubclass(items[2]);
        info.setDepartureDate(items[3]);

        flights.add(info);
      } catch (Exception ex) {
        logger.error(ex.getMessage() + ". :" + routeDetail);
      }

      routeDetail = routeDetail.substring(m.end());
      if (routeDetail.length() == 0) {
        break;
      } else {
        m = PATTERN_SHORT.matcher(routeDetail);
      }
    }
  }





  public static StringBuilder exportPassengerTitle() {
    StringBuilder sb = new StringBuilder();
    sb.append("英文名,");
    sb.append("中文名,");
    sb.append("性别,");
    sb.append("手机,");
    sb.append("电话,");
    sb.append("email,");
    sb.append("生日,");
    sb.append("身份证号,");
    sb.append("护照号,");
    sb.append("护照有效期,");
    sb.append("国籍,");
    sb.append("公司,");
    sb.append("创建日期,");

    sb.append("\r");

    return sb;
  }

  public static StringBuilder exportPassengerContent(PassengerDto dto) {
    StringBuilder sb = new StringBuilder();
    sb.append(dto.getNameEn()).append(",");
    sb.append(dto.getNameCn()).append(",");

    //性别
    if (dto.getGender() != null) {
      if (dto.getGender() == 1) {
        sb.append("男");
      } else if (dto.getGender() == 2) {
        sb.append("女");
      }
    }
    sb.append(",");

    if (dto.getMobile() != null) {
      sb.append(dto.getMobile());
    }
    sb.append(",");

    if (dto.getPhone() != null) {
      sb.append(dto.getPhone());
    }
    sb.append(",");

    if (dto.getEmail() != null) {
      sb.append(dto.getEmail());
    }
    sb.append(",");

    sb.append(dto.getBirthday()).append(",");

    if (dto.getIdNo() != null) {
      sb.append(dto.getIdNo());
    }
    sb.append(",");

    if (dto.getPassportNo() != null) {
      sb.append(dto.getPassportNo());
    }
    sb.append(",");

    if (dto.getPassportExpiry() != null) {
      sb.append(dto.getPassportExpiry());
    }
    sb.append(",");

    sb.append(dto.getNationality()).append(",");

    if (dto.getCustomer() != null) {
      sb.append(dto.getCustomer().getName());
    }
    sb.append(",");

    if (dto.getCreateTime() != null) {
      sb.append(DateUtil.formatDate(dto.getCreateTime(), DEFAULT_DATE_FORMAT));
    }
    sb.append(",");

    sb.append("\r");
    return sb;
  }

  public static StringBuilder exportTitle(List<DataFieldExportInfo> exportInfos) {
    StringBuilder sb = new StringBuilder();

    if (exportInfos == null || exportInfos.isEmpty()) {
      sb.append("\r");
      return sb;
    }

    int curColumnIndex = 0;

    for (DataFieldExportInfo exportInfo : exportInfos) {

      if (exportInfo.getColumnIndex() <= curColumnIndex) {
        continue;
      }

      curColumnIndex = exportInfo.getColumnIndex();

      sb.append(exportInfo.getAlias());
      sb.append(",");
    }
    sb.append("\r");

    return sb;
  }

  private static boolean isContainDataType(List<DataFieldExportInfo> exportInfos, final int dataType) {
    for (DataFieldExportInfo exportInfo : exportInfos) {
      if (dataType == exportInfo.getDataType()) {
        return true;
      }
    }
    return false;
  }

  /**
   * 导出账单内容
   *
   * @param info          账单信息
   * @param exportInfos   导出字段格式
   * @param airports      机场信息，用于导出信息的机场代码转换
   * @param reportShowFee 服务费报表显示设置
   *                      * 0-不单独显示，与航司销售价、航司退票费、航司改签费合并
   *                      * 1-单独显示
   * @return
   */
  public static StringBuilder exportContent(BillInfo info, List<DataFieldExportInfo> exportInfos,
                                            final List<Airport> airports, final int reportShowFee) {
    StringBuilder sb = new StringBuilder();

    final String billType = info.getBillType();

    if (BILL_TYPE_FLIGHT.equals(billType)) {
      //1.只留机票相关的列, 并按照列序号排序
      final List<DataFieldExportInfo> flightExportInfos = exportInfos
              .stream()
              .filter(t -> (
                      t.getDataType() == DATA_TYPE_FLIGHT
                              || t.getDataType() == DATA_TYPE_GENERAL
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());
      doExportFlightOrderContent(sb, flightExportInfos, info, airports, reportShowFee);
    } else if (BILL_TYPE_FLIGHT_REFUND.equals(billType)) {
      //退票账单
      final List<DataFieldExportInfo> refundExportInfos = exportInfos
              .stream()
              .filter(t -> (t.getDataType() == DATA_TYPE_GENERAL
                              || t.getDataType() == DATA_TYPE_FLIGHT_REFUND
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());
      doExportRefundOrderContent(sb, refundExportInfos, info, airports, reportShowFee);
    } else if (BILL_TYPE_FLIGHT_CHANGE.equals(billType)) {
      //改签账单
      final List<DataFieldExportInfo> flightExportInfos = exportInfos
              .stream()
              .filter(t -> (t.getDataType() == DATA_TYPE_GENERAL
                      || t.getDataType() == DATA_TYPE_FLIGHT_CHANGE
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());

      doExportChangeOrderContent(sb, flightExportInfos, info, airports, reportShowFee);

    } else if (BILL_TYPE_HOTEL.equals(billType)) {
      //酒店账单
      final List<DataFieldExportInfo> hotelExportInfos = exportInfos
              .stream()
              .filter(t -> (t.getDataType() == DataFieldInfo.DATA_TYPE_HOTEL
                      || t.getDataType() == DATA_TYPE_GENERAL
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());
      doExportHotelOrderContent(sb, hotelExportInfos, info, airports, reportShowFee);

    } else if (BILL_TYPE_TRAIN.equals(billType)) {
      //火车票账单
      final List<DataFieldExportInfo> trainExportInfos = exportInfos
              .stream()
              .filter(t -> (t.getDataType() == DataFieldInfo.DATA_TYPE_TRAIN
                      || t.getDataType() == DATA_TYPE_GENERAL
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());
      doExportTrainOrderContent(sb, trainExportInfos, info, airports, reportShowFee);
    } else if (BILL_TYPE_CAR.equals(billType)) {
      //用车账单
      final List<DataFieldExportInfo> carExportInfos = exportInfos
              .stream()
              .filter(t -> (t.getDataType() == DataFieldInfo.DATA_TYPE_CAR
                      || t.getDataType() == DATA_TYPE_GENERAL
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());
      doExportCarOrderContent(sb, carExportInfos, info, airports, reportShowFee);

    } else if (BILL_TYPE_VAS.equals(billType)) {
      //服务账单
      final List<DataFieldExportInfo> vasExportInfos = exportInfos
              .stream()
              .filter(t -> (t.getDataType() == DATA_TYPE_VAS
                      || t.getDataType() == DATA_TYPE_GENERAL
              ))
              .sorted(Comparator.comparing(DataFieldExportInfo::getColumnIndex))
              .collect(Collectors.toList());
      doExportVasOrderContent(sb, vasExportInfos, info, airports, reportShowFee);

    }

    return sb;
  }

  /**
   * 导出机票订单的内容
   *
   * @param sb
   * @param flightExportInfos
   * @param info
   * @param airports
   */
  private static void doExportFlightOrderContent(StringBuilder sb, List<DataFieldExportInfo> flightExportInfos,
                                                 BillInfo info, final List<Airport> airports,
                                                 final int reportShowFee) {
    //该账单中可以包含多张票号内容, 只有第一张票导出账单金额（如果每张票号都导出账单金额，就会重复导致金额变大）
    int itemOrder = 0;
    for (BillFlightTicket ticket : info.getTickets()) {
      itemOrder++;
      int segIndex = 0;
      for (BillFlightTicketDetail segInfo : ticket.getDetails()) {
        segIndex++;
        for (DataFieldExportInfo exportInfo : flightExportInfos) {
          String newVal = getFlightExportValue(exportInfo.getDataFieldInfo().getId(), ticket, segInfo, segIndex, airports, reportShowFee);
          if (newVal == null) {
            newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, segIndex);
          }

          if (newVal != null) {
            sb.append(newVal);
          }

          sb.append(",");
        }
        sb.append("\r");
      }
    }
  }

  private static void doExportRefundOrderContent(StringBuilder sb, List<DataFieldExportInfo> exportInfos,
                                                 BillInfo info, final List<Airport> airports,
                                                 final int reportShowFee) {
    int itemOrder = 0;
    for (BillFlightRefundTicket ticket : info.getRefundTickets()) {
      itemOrder++;
      for (DataFieldExportInfo exportInfo : exportInfos) {
        String newVal = getFlightRefundExportValue(exportInfo.getDataFieldInfo().getId(), ticket, airports, reportShowFee);
        if (newVal == null) {
          newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, 1);
        }

        if (newVal != null) {
          sb.append(newVal);
        }
        sb.append(",");
      }

      sb.append("\r");
    }
  }

  private static void doExportChangeOrderContent(StringBuilder sb, List<DataFieldExportInfo> flightExportInfos,
                                                 BillInfo info, final List<Airport> airports,
                                                 final int reportShowFee) {
    int itemOrder = 0;
    for (BillChangeOrder ticket : info.getChangeOrders()) {
      itemOrder++;
      int segIndex0 = 0;
      int segIndex1 = 0;
      for (FlightInfo flightInfo : ticket.getFlights()) {
        segIndex0++;

        if (flightInfo.getFlightType() == 0) {
          //改签前的航班信息不显示
          //TODO 如果此处只有改签前的航班怎么处理？目前碰到了。
          continue;
        }
        segIndex1++;

        for (DataFieldExportInfo exportInfo : flightExportInfos) {
          String newVal = getFlightChangeExportValue(exportInfo.getDataFieldInfo().getId(), ticket, segIndex0, segIndex1, airports, reportShowFee);
          if (newVal == null) {
            newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, segIndex1);
          }

          if (newVal != null) {
            sb.append(newVal);
          }

          sb.append(",");
        }

        sb.append("\r");
      }

      if (segIndex0 == 0 || segIndex1 == 0) {
        //此处两者都不应该为0
        logger.error("Failed to export change bill content(" + info.getBillNum() + ").");
      }
    }
  }

  private static void doExportHotelOrderContent(StringBuilder sb, List<DataFieldExportInfo> exportInfos,
                                                BillInfo info, final List<Airport> airports,
                                                final int reportShowFee) {
    int itemOrder = 0;
    for (BillHotelBooking ticket : info.getHotelBookings()) {
      itemOrder++;
      for (DataFieldExportInfo exportInfo : exportInfos) {
        String newVal = getHotelExportValue(exportInfo.getDataFieldInfo().getId(), ticket);
        if (newVal == null) {
          newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, 1);
        }

        if (newVal != null) {
          sb.append(newVal);
        }

        sb.append(",");
      }

      sb.append("\r");
    }
  }


  private static void doExportTrainOrderContent(StringBuilder sb, List<DataFieldExportInfo> exportInfos,
                                                BillInfo info, final List<Airport> airports,
                                                final int reportShowFee) {
    int itemOrder = 0;
    for (BillTrainTicket ticket : info.getTrainTickets()) {
      itemOrder++;
      for (DataFieldExportInfo exportInfo : exportInfos) {
        String newVal = getTrainExportValue(exportInfo.getDataFieldInfo().getId(), ticket);
        if (newVal == null) {
          newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, 1);
        }

        if (newVal != null) {
          sb.append(newVal);
        }

        sb.append(",");
      }

      sb.append("\r");
    }
  }

  private static void doExportCarOrderContent(StringBuilder sb, List<DataFieldExportInfo> exportInfos,
                                                BillInfo info, final List<Airport> airports,
                                                final int reportShowFee) {
    int itemOrder = 0;
    for (BillRentalCarOrder carOrder : info.getCarOrders()) {
      itemOrder++;
      for (DataFieldExportInfo exportInfo : exportInfos) {
        String newVal = getCarExportValue(exportInfo.getDataFieldInfo().getId(), carOrder);
        if (newVal == null) {
          newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, 1);
        }

        if (newVal != null) {
          sb.append(newVal);
        }

        sb.append(",");
      }

      sb.append("\r");
    }
  }


  private static void doExportVasOrderContent(StringBuilder sb, List<DataFieldExportInfo> exportInfos,
                                              BillInfo info, final List<Airport> airports,
                                              final int reportShowFee) {
    int itemOrder = 0;
    for (BillVasOrder ticket : info.getVasOrders()) {
      itemOrder++;
      for (DataFieldExportInfo exportInfo : exportInfos) {
        String newVal = getVasExportValue(exportInfo.getDataFieldInfo().getId(), ticket);
        if (newVal == null) {
          newVal = getBillExportValue(exportInfo.getDataFieldInfo().getId(), info, itemOrder, 1);
        }

        if (newVal != null) {
          sb.append(newVal);
        }

        sb.append(",");
      }

      sb.append("\r");
    }
  }

  /**
   * @param dataFieldId   导出字段的id
   * @param ticket        要导出的票号信息
   * @param segIndex      要导出第几航段的信息
   * @param airports
   * @param reportShowFee
   * @return
   */
  private static String getFlightExportValue(final int dataFieldId, BillFlightTicket ticket, BillFlightTicketDetail segInfo,
                                             final int segIndex,
                                             List<Airport> airports, final int reportShowFee) {
    String retVal = null;

    switch (dataFieldId) {
      case DataFieldConst.COLUMN_BLANK:
        retVal = "";
        break;
      case DataFieldConst.FLIGHT_TICKET_NO:
        retVal = segIndex == 1 ? ticket.getShowTicketNo() : "";
        break;
      case DataFieldConst.TEN_TICKET_NO:
        retVal = segIndex == 1 ? ticket.getTicketNo() : "";
        break;
      case DataFieldConst.FLIGHT_DDATE:
        retVal = segInfo.getDdate();
        break;
      case DataFieldConst.FLIGHT_PASSENGER:
        retVal = segIndex == 1 ? ticket.getPassengerName() : "";
        break;
      case DataFieldConst.FLIGHT_DPORT:
        retVal = StringUtils.isEmpty(segInfo.getDportName()) ? segInfo.getDport(): segInfo.getDportName();
        break;
      case DataFieldConst.FLIGHT_APORT:
        retVal = StringUtils.isEmpty(segInfo.getAportName()) ? segInfo.getAport() : segInfo.getAportName();
        break;
      case DataFieldConst.FLIGHT_FLIGHT_NO:
        retVal = segInfo.getFlight() == null ? "" : segInfo.getFlight();
        break;
      case DataFieldConst.FLIGHT_PAR_VALUE:
        final double showPrice = reportShowFee == 0 ? (ticket.getParvalue() + ticket.getServiceCharge()) : ticket.getParvalue();
        retVal = segIndex == 1 ? showPrice + "" : "";
        break;
      case DataFieldConst.FLIGHT_TAX:
        retVal = segIndex == 1 ? ticket.getTax() + "" : "";
        break;
      case DataFieldConst.FLIGHT_SERVICE:
        final double showServiceCharge = reportShowFee == 0 ? 0 : ticket.getServiceCharge();
        retVal = segIndex == 1 ? showServiceCharge + "" : "";
        break;
      case DataFieldConst.FLIGHT_AMOUNT:
        retVal = segIndex == 1 ? ticket.getAccountRecv() + "" : "";
        break;
      case DataFieldConst.FLIGHT_OP1:
        retVal = ticket.getOperator();
        break;
      case DataFieldConst.FLIGHT_RECEIVE_STATUS:
        retVal = getBePaidDesc(ticket.getBePaid());
        break;
      case DataFieldConst.FLIGHT_USED_STATUS:
        retVal = ticket.getUseStatus();
        break;
      case DataFieldConst.FLIGHT_PNR_NO:
        retVal = ticket.getPnrNo();
        break;
      case DataFieldConst.FLIGHT_SUB_CLASS:
        retVal = segInfo.getSubclass();
        break;
      case DataFieldConst.FLIGHT_DPORT_NAME:
        retVal = segInfo.getDportName();
        break;
      case DataFieldConst.FLIGHT_DTERM:
        retVal = segInfo.getDterm();
        break;
      case DataFieldConst.FLIGHT_APORT_NAME:
        retVal = segInfo.getAportName();
        break;
      case DataFieldConst.FLIGHT_ATERM:
        retVal = segInfo.getAterm();
        break;
      case DataFieldConst.FLIGHT_DTIME:
        retVal = segInfo.getDtime();
        break;
      case DataFieldConst.FLIGHT_ATIME:
        retVal = segInfo.getAtime();
        break;
      case DataFieldConst.FLIGHT_ROUTE_INFO:
        retVal = ticket.getRouteDetail();
        break;
      case DataFieldConst.FLIGHT_REMARK:
        retVal = ticket.getRemark() == null ? "" : ticket.getRemark();
        break;
      case DataFieldConst.FLIGHT_PRICE:
        retVal = ticket.getPrice() + "";
        break;
      case DataFieldConst.FLIGHT_INSURANCE:
        retVal = ticket.getInsurance() + "";
        break;
      case DataFieldConst.FLIGHT_COMMISSION:
        retVal = ticket.getCommission() + "";
        break;
      case DataFieldConst.FLIGHT_DISCOUNT:
        retVal = ticket.getDiscount() + "";
        break;
      case DataFieldConst.FLIGHT_PROFIT:
        retVal = ticket.getProfit() + "";
        break;
      default:
    }

    return retVal;
  }

  private static String getFlightRefundExportValue(final int exportInfoId, BillFlightRefundTicket ticket,
                                                   List<Airport> airports,
                                                   final int reportShowFee) {
    String retVal = null;

    switch (exportInfoId) {
      case DataFieldConst.FLIGHT_TICKET_NO:
        retVal = ticket.getBalanceCode() + "-" + ticket.getTicketNo();
        break;
      case DataFieldConst.FLIGHT_DDATE:
        retVal = ticket.getDdate();
        break;
      case DataFieldConst.FLIGHT_PASSENGER:
        retVal = ticket.getPsgName();
        break;
      case DataFieldConst.FLIGHT_PNR_NO:
        retVal = ticket.getPnrNo();
        break;
      case DataFieldConst.FLIGHT_DPORT:
        retVal = getAirportName(ticket.getDport(), airports);
        break;
      case DataFieldConst.FLIGHT_APORT:
        retVal = getAirportName(ticket.getAport(), airports);
        break;
      case DataFieldConst.FLIGHT_FLIGHT_NO:
        retVal = ticket.getFlightNo();
        break;
      case DataFieldConst.FLIGHT_SUB_CLASS:
        retVal = ticket.getSubclass();
        break;
      case DataFieldConst.FLIGHT_DTERM:
        retVal = ticket.getDterm() + "";
        break;
      case DataFieldConst.FLIGHT_ATERM:
        retVal = ticket.getAterm() + "";
        break;
      case DataFieldConst.FLIGHT_PAR_VALUE:
        retVal = -ticket.getTicketAmount() + "";
        break;
      case DataFieldConst.FLIGHT_TAX:
        retVal = "0";
        break;
      case DataFieldConst.REFUND_AIR_CHARGE:
        final double showRefundCharge = reportShowFee == 1 ? ticket.getAirRefundCharge() : (ticket.getAirRefundCharge() + ticket.getServiceCharge());
        retVal = showRefundCharge + "";
        break;
      case DataFieldConst.FLIGHT_SERVICE:
        final double showServiceCharge = reportShowFee == 1 ? ticket.getServiceCharge() : 0;
        retVal = showServiceCharge + "";
        break;
      case DataFieldConst.FLIGHT_AMOUNT:
        retVal = -ticket.getPassengerRefundAmount() + "";
        break;
      case DataFieldConst.REFUND_REASON:
        retVal = showReasonCodeDesc(ticket.getReasonCode()) + "";
        break;
      case DataFieldConst.FLIGHT_DTIME:
        retVal = ticket.getDtime() + "";
        break;
      case DataFieldConst.FLIGHT_ATIME:
        retVal = ticket.getAtime() + "";
        break;
      case DataFieldConst.REFUND_TICKET_AMOUNT:
        retVal = ticket.getTicketAmount() + "";
        break;
      case DataFieldConst.REFUND_FINAL_AIR_REFUND:
        retVal = ticket.getAirlineRefundAmount() + "";
        break;
      case DataFieldConst.REFUND_FINAL_PSG_REFUND:
        retVal = -ticket.getPassengerRefundAmount() + "";
        break;
      case DataFieldConst.REFUND_DATE_AIR_REFUND:
        retVal = ticket.getAirlineRefundDate() == null ? "" : DateUtil.formatDate(ticket.getAirlineRefundDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.REFUND_DATE_PSG_REFUND:
        retVal = ticket.getPsgRefundDate() == null ? "" : DateUtil.formatDate(ticket.getPsgRefundDate(), DEFAULT_DATE_FORMAT);
        break;

      default:
        break;
    }

    return retVal;
  }

  /**
   * @param exportInfoId
   * @param ticket
   * @param segIndex0    包括所有航班信息都计算在内的序号
   * @param segIndex1    仅计算改签后航班在内的序号
   * @param airports
   * @return
   */
  private static String getFlightChangeExportValue(final int exportInfoId, BillChangeOrder ticket,
                                                   final int segIndex0, final int segIndex1,
                                                   List<Airport> airports, final int reportShowFee) {
    String retVal = null;

    FlightInfo flightInfo = ticket.getFlights().get(segIndex0 - 1);

    switch (exportInfoId) {
      case DataFieldConst.FLIGHT_TICKET_NO:
        retVal = segIndex1 == 1 ? (ticket.getBalanceCode() + "-" + ticket.getTicketNo()) : "";
        break;
      case DataFieldConst.FLIGHT_DDATE:
        retVal = flightInfo.getDdate();
        break;
      case DataFieldConst.FLIGHT_PASSENGER:
        retVal = segIndex1 == 1 ? ticket.getPsgName() : "";
        break;
      case DataFieldConst.FLIGHT_DPORT:
        retVal = flightInfo.getDport();
        break;
      case DataFieldConst.FLIGHT_APORT:
        retVal = flightInfo.getAport();
        break;
      case DataFieldConst.FLIGHT_FLIGHT_NO:
        retVal = flightInfo.getFlightNo();
        break;
      case DataFieldConst.FLIGHT_PAR_VALUE:
        retVal = segIndex1 == 1 ? ticket.getParvalue() + "" : "";
        break;

      case DataFieldConst.FLIGHT_TAX:
        retVal = segIndex1 == 1 ? "0.0" : "";
        break;
      case DataFieldConst.CHANGE_AIR_CHARGE:
        final double showAirCharge = reportShowFee == 1 ? ticket.getAirChangeCharge() : (ticket.getAirChangeCharge() + ticket.getServiceCharge());
        retVal = segIndex1 == 1 ? showAirCharge + "" : "";
        break;
      case DataFieldConst.FLIGHT_SERVICE:
        final double showServiceCharge = reportShowFee == 1 ? ticket.getServiceCharge() : 0;
        retVal = segIndex1 == 1 ? showServiceCharge + "" : "";
        break;

      case DataFieldConst.FLIGHT_AMOUNT:
        retVal = segIndex1 == 1 ? (ticket.getAirChangeCharge() + ticket.getServiceCharge()) + "" : "";
        break;
      case DataFieldConst.CHANGE_TICKET_NO:
        retVal = segIndex1 == 1 ? ticket.getNewTicketNo() : "";
        break;
      default:
        break;
    }

    return retVal;
  }

  private static String getHotelExportValue(final int exportInfoId, BillHotelBooking ticket) {
    String retVal = null;

    switch (exportInfoId) {
      case DataFieldConst.HOTEL_NAME:
        retVal = ticket.getHotelName().replace(",", " ");
        break;
      case DataFieldConst.HOTEL_ROOM_TYPE:
        retVal = ticket.getRoomType().replace(",", " ");
        break;
      case DataFieldConst.HOTEL_ROOM_COUNT:
        retVal = ticket.getRoomCount() + "";
        break;
      case DataFieldConst.HOTEL_ROOM_NIGHT_COUNT:
        retVal = ticket.getCount() + "";
        break;
      case DataFieldConst.HOTEL_CHECK_IN:
        retVal = DateUtil.formatDate(ticket.getDdate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.HOTEL_CHECK_OUT:
        retVal = DateUtil.formatDate(ticket.getLeaveDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.HOTEL_PASSENGER:
        retVal = ticket.getPassengerName().replace(",", " ");
        break;
      case DataFieldConst.HOTEL_PRICE:
        retVal = ticket.getPrice() + "";
        break;
      case DataFieldConst.HOTEL_BOTTOM_PRICE:
        retVal = ticket.getBottomPrice() + "";
        break;
      case DataFieldConst.HOTEL_SERVICE:
        retVal = ticket.getServiceCharge() + "";
        break;
      case DataFieldConst.HOTEL_AMOUNT:
        retVal = ticket.getTotalAmount() + "";
        break;
      default:
        break;
    }

    return retVal;
  }

  private static String getTrainExportValue(final int exportInfoId, BillTrainTicket ticket) {
    String retVal = null;
    switch (exportInfoId) {
      case DataFieldConst.TRAIN_NO:
        retVal = ticket.getTrainNo();
        break;
      case DataFieldConst.TRAIN_PASSENGER:
        retVal = ticket.getPassengerName().trim().replace(",", ";");
        break;
      case DataFieldConst.TRAIN_DEPARTURE_STATION:
        retVal = ticket.getDcity();
        break;
      case DataFieldConst.TRAIN_ARRIVAL_STATION:
        retVal = ticket.getAcity();
        break;
      case DataFieldConst.TRAIN_DEPARTURE_DATE:
        retVal = DateUtil.formatDate(ticket.getDdate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.TRAIN_SEAT_CLASS:
        retVal = ticket.getSeatClass();
        break;
      case DataFieldConst.TRAIN_PRICE:
        retVal = ticket.getPrice() + "";
        break;
      case DataFieldConst.TRAIN_SERVICE:
        retVal = ticket.getServiceCharge() + "";
        break;
      case DataFieldConst.TRAIN_AMOUNT:
        retVal = ticket.getTotal() + "";
        break;
      default:
        break;
    }

    return retVal;
  }

  private static String getCarExportValue(final int exportInfoId, BillRentalCarOrder ticket) {
    String retVal = null;
    switch (exportInfoId) {
      case DataFieldConst.CAR_USE_TYPE:
        retVal = getCarUseType(ticket.getUseType());
        break;
      case DataFieldConst.CAR_CITY_NAME:
        retVal = ticket.getCityName();
        break;
      case DataFieldConst.CAR_DEPARTURE:
        retVal = ticket.getDepartureAddress();
        break;
      case DataFieldConst.CAR_ARRIVAL:
        retVal = ticket.getArrivalAddress();
        break;
      case DataFieldConst.CAR_USE_TIME:
        retVal = DateUtil.formatDate(ticket.getUseTime(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.CAR_LINK_NAME:
        retVal = ticket.getLinkman();
        break;
      case DataFieldConst.CAR_VEHICLE_NAME:
        retVal = ticket.getVehicleTypeName();
        break;
      case DataFieldConst.CAR_REMARK:
        retVal = ticket.getRemark() + "";
        break;
      default:
        break;
    }


    return retVal;
  }

  public static String getCarUseType(int useType) {
    switch (useType) {
      case 1: return "接机";
      case 2: return "送机";
      case 3: return "接火车";
      case 4: return "送火车";
      default:
        return "其它";
    }
  }

  /**
   * 输出账单的通用信息，一个账单可能会带有多张机票等，所以在输出账单金额时，只在第一个内容（目前主要是机票）上输出
   * @param exportInfoId
   * @param info
   * @param itemOrder 账单包含项目的编号(机票账单指的是第几张机票）
   * @param segOrder 当前机票中所包含的航段中的第几段
   * @return
   */
  private static String getBillExportValue(final int exportInfoId, BillInfo info, final int itemOrder, final int segOrder) {
    String retVal = null;

    switch (exportInfoId) {
      case DataFieldConst.BILL_ETDZ_DATE:
        retVal = info.getEtdzDate() == null ? "" : DateUtil.formatDate(info.getEtdzDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.BILL_CUSTOMER_NAME:
        retVal = info.getCustomerType() == 0 ? "散客" : (info.getCustomer() == null ? "?" : info.getCustomer().getVipName());
        break;
      case DataFieldConst.BILL_TYPE:
        retVal = getBillTypeDesc(info.getBillType());
        break;
      case DataFieldConst.BILL_COST_CENTER:
        final String costCenter = info.getCostCenter() == null ? "" : info.getCostCenter();
        retVal = costCenter.replace(",", " ");
        break;
      case DataFieldConst.BILL_DATE:
        retVal = info.getOpDate() == null ? "" : DateUtil.formatDate(info.getOpDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.BILL_RECEIPT_STATUS:
        retVal = getBePaidDesc(info.getBePaid());
        break;
      case DataFieldConst.BILL_PAYMENT_STATUS:
        retVal = info.getPaymentStatus() == 0 ? "未付" : "已付";
        break;
      case DataFieldConst.BILL_OP1:
        retVal = info.getOp1();
        break;
      case DataFieldConst.BILL_OP2:
        retVal = info.getOp2() == null ? "" : info.getOp2().trim();
        break;
      case DataFieldConst.BILL_OP3:
        retVal = info.getOp3();
        break;
      case DataFieldConst.BILL_CUSTOMER_CODE:
        retVal = info.getCustomerCode();
        break;
      case DataFieldConst.BILL_PROJECT_NAME:
        retVal = info.getProjectName();
        break;
      case DataFieldConst.BILL_NO:
        retVal = info.getBillNum();
        break;
      case DataFieldConst.BILL_AUDIT_DATE:
        retVal = info.getAuditDate() == null ? "" : DateUtil.formatDate(info.getAuditDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.BILL_SETTLE_DATE:
        retVal = info.getSettleDate() == null ? "" : DateUtil.formatDate(info.getSettleDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.BILL_WRITE_OFF_DATE:
        retVal = info.getWriteOffDate() == null ? "" : DateUtil.formatDate(info.getWriteOffDate(), DEFAULT_DATE_FORMAT);
        break;
      case DataFieldConst.BILL_SUPPLIER:
        retVal = info.getSupplier() == null ? "" : info.getSupplier().getName();
        break;
      case DataFieldConst.BILL_PAYMENT_METHOD:
        retVal = info.getPaymentMethod() == null ? "" : info.getPaymentMethod().getName();
        break;
      case DataFieldConst.BILL_SALE_MAN:
        //获取销售员
        retVal = info.getCustomer() == null ? "" : info.getCustomer().getSalesStaff();;
        break;
      case DataFieldConst.BILL_IS_INTL:
        retVal = getIntlTicketDesc(info.getIntlTicket());
        break;
      case DataFieldConst.BILL_FLIGHT_ORDER_NO:
        retVal = info.getFlightOrderNo();
        break;
      case DataFieldConst.BILL_AUDIT_STATUS:
        retVal = info.getAuditedDesc();
        break;
      case DataFieldConst.BILL_SETTLE_NO:
        retVal = info.getSettlementNo();
        break;
      case DataFieldConst.BILL_RECEIPT_TYPE:
        retVal = getPayTypeNoteDesc(info.getPayTypeNote());
        break;
      case DataFieldConst.BILL_RECEIPT_REMARK:
        retVal = info.getPayRemark();
        break;
      case DataFieldConst.BILL_RECEIPT_NO:
        retVal = info.getReceiptNo();
        break;
      case DataFieldConst.BILL_TOTAL:
        retVal = (itemOrder == 1 && segOrder == 1) ? info.getBillSum() + "" : "";
        break;
      case DataFieldConst.BILL_COST:
        retVal = (itemOrder == 1 && segOrder == 1) ? info.getCost() + "" : "";
        break;
      case DataFieldConst.BILL_PROFIT:
        retVal = (itemOrder == 1 && segOrder == 1) ? info.getProfit() + "" : "";
        break;
      case DataFieldConst.BILL_OPERATOR:
        retVal = info.getOperator();
        break;
      case DataFieldConst.BILL_ORDER_NO:
        retVal = info.getOrderNo();
        break;
      case DataFieldConst.BILL_REMARK:
        retVal = info.getRemark().replace(",", " ");
        break;


      default:
        break;
    }

    return retVal;
  }

  private static String getVasExportValue(final int exportInfoId, BillVasOrder ticket) {
    String retVal = null;

    switch (exportInfoId) {
      case DataFieldConst.VAS_PRODUCT_NAME:
        retVal = ticket.getProductName();
        break;
      case DataFieldConst.VAS_COUNT:
        retVal = ticket.getCount() + "";
        break;
      case DataFieldConst.VAS_PRICE:
        retVal = ticket.getPrice() + "";
        break;
      case DataFieldConst.VAS_COST:
        retVal = ticket.getCost() + "";
        break;
      case DataFieldConst.VAS_AMOUNT:
        retVal = ticket.getTotal() + "";
        break;
      case DataFieldConst.VAS_REMARK:
        retVal = ticket.getRemark();
        break;
      default:
        break;
    }

    return retVal;
  }


  /**
   * 个人散客：散客，成本中心（如果有代订人，则填入代订人的电话和名字；以后如果是网上散客，则直接用该散客的） 企业散客：散客，客户编号（企业散客的客户编码），成本中心（企业散客的名称）
   * 企业：企业，客户编号，成本中心（订单中有就带过来，没有则留空）
   *
   * @param customerType 客户类型 0-散客，1-企业客户
   * @param linkMan      代订联系人
   * @param linkPhone    代订联系人电话
   * @param customer     客户信息
   */
  public static void setBillCustomerInfo(BillInfo o, final int customerType, final String linkMan,
                                   final String linkPhone, Customer customer) {
    if (customerType == 0) {
      // 个人散客
      o.setCustomerType(0);
      if (linkMan != null || linkPhone != null) {
        o.setCostCenter(linkMan + "," + linkPhone);
      }
    } else if (customer != null) {
      // 企业客户
      if (customer.getEnterpriseType() == Customer.ENT_INDIVIDUAL) {
        //企业散客
        o.setCustomerType(0);
        o.setCustomer(null);
        o.setCustomerCode(customer.getCustomerCode());
        o.setCostCenter(customer.getVipName());
      } else {
        // 企业
        o.setCustomerType(customerType);
        o.setCustomer(customer);
        o.setCustomerCode(customer.getCustomerCode());
      }
    }
  }


//2359
}
